package com.diankangwo.dao.impl;

import com.diankangwo.dao.InvitationDAO;
import com.diankangwo.domain.Invitation;
import com.diankangwo.util.PageSupport;
import org.springframework.stereotype.Repository;

@Repository
public class InvitationDAOImpl extends BaseDaoImpl<Invitation> implements InvitationDAO  {

	@Override
	public PageSupport<Invitation> findByUid(Integer id,int pageNo,int pageSize) {
		PageSupport<Invitation> invitationList = new PageSupport<>();
		invitationList =  findPagination("from Invitation i where i.uid = ?",pageNo,pageSize, id);
		if (invitationList == null || invitationList.getResultData().size() ==0) {
			return null;
		}else{
			return invitationList;
		}
	}

	@Override
	public PageSupport<Invitation> findByFUid(String fuid,int pageNo,int pageSize) {
		PageSupport<Invitation> invitationList = new PageSupport<>();
		invitationList =  findPagination("from Invitation i where i.fuid = ?",pageNo,pageSize, fuid);
		if (invitationList == null || invitationList.getResultData().size() ==0) {
			return null;
		}else{
			return invitationList;
		}
	}

}
